package com.julian.iteratorPattern;

import java.util.ArrayList;
import java.util.Iterator;

public class PancakeHouseMenu implements Menu{
    ArrayList menuItems;

    public PancakeHouseMenu() {
        this.menuItems = new ArrayList();
        addItem("K&B'sPancake Breakfast","Pancakes with scrambled eggs, and toast",
                true,2.99);
        addItem("Regular Pancake Breakfast","Pancakes with fries eggs, sausage",
                false,2.99);
        addItem("Blueberry Pancakes", "Pancakes made with fresh blueberries",
                true,3.49);
        addItem("Waffles","Waffles, with your chioce of blueberries or starwberries",
                true,3.59);
    }

    public void addItem(String name, String description, boolean vegetarian, double price){
        MenuItem menuItem = new MenuItem(name,description,vegetarian,price);
        menuItems.add(menuItem);
    }

    @Override
    public Iterator createIterator(){
//        return new PancakeHouseIterator(menuItems);
        return menuItems.iterator();//ArrayList自身继承iterator接口
    }

//    public ArrayList getMenuItems() {
//        return menuItems;
//    }
}
